package com.interview.feign;

import com.interview.config.FeignConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.ribbon.FeignRibbonClientAutoConfiguration;
import org.springframework.web.bind.annotation.*;

/**
 * Created by fangjicai on 2020/4/17.
 */
//在集群环境下，也可指定具体调用那个端口的服务
//@FeignClient(name = "interview-provider-1",url = "http://localhost:8401",path = "/xxx")
//@FeignClient(name = "interview-provider-1",primary = true)
//@FeignClient(name = "interview-provider-1",primary = true,configuration = FeignConfiguration.class)
@FeignClient(name = "interview-provider-1",fallback = ProviderApiFallback.class)
public interface ProviderApi {
    @RequestMapping(value = "/name/{id}",method = RequestMethod.GET)
    public String getName(@PathVariable("id") String id);
// 如果服务提供端不是restfull风格接口，也可使用如下注解
// @RequestMapping(value = "/name",method = RequestMethod.GET)
// public String getName2(@RequestParam("id") String id);

}
